﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MoPhongLapLich
{
    class Timer
    {
        public event EventHandler<TickEventArgs> Tick;
        public bool Stop;
        public int _tick=-1;
        public void OnTick(TickEventArgs e)
        {
            EventHandler<TickEventArgs> handler = Tick;
            if (handler != null) handler(this, e);
        }

        public void Run ()
        {
            while(!Stop)
            {
                _tick++;
                OnTick(new TickEventArgs(_tick));
                Glogal.GlogalTime = _tick;
            }
        }
    }

    public class TickEventArgs:EventArgs
    {
        public readonly int TickTime;

        public TickEventArgs(int tickTime)
        {
            TickTime = tickTime;
        }
    }
}
